<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateServiceTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('service', function (Blueprint $table) {
            $table->increments('id');
            $table->string('designation')->index()->comment('服务站名称');
            $table->string('name')->index()->comment('负责人姓名');
            $table->string('phone')->index()->comment('手机号');
            $table->unsignedInteger('province_id')->nullable()->comment('省');
            $table->unsignedInteger('city_id')->nullable()->comment('市');
            $table->unsignedInteger('district_id')->nullable()->comment('县/区');
            $table->string('address')->nullable()->comment('详细地址');
            $table->decimal('service_money', 10, 2)->default(0.00)->comment('服务站余额');
            $table->string('start_time')->default("09:00")->comment('开始营业时间');
            $table->string('end_time')->default("18:00")->comment('结束营业时间');
            $table->string('service_img')->nullable()->comment('证件');
            $table->string('bank_card')->nullable()->comment('银行卡号');
            $table->string('region')->nullable()->comment('派送范围');
            $table->string('not_region')->nullable()->comment('不派送范围');
            $table->integer('pid')->default(0)->comment('父级服务站');
            $table->string('community')->nullable()->comment('经营小区');
            $table->string('scope', 1000)->nullable()->comment('经营范围');
            $table->unsignedInteger('zoom')->nullable()->comment('经营范围缩放级别');
            $table->unsignedTinyInteger('is_child')->default(0)->comment('0:父级站点  1：子级站点');
            $table->unsignedTinyInteger('status')->default(1)->comment('1:正常  2：禁用');
            $table->decimal('total_income', 10, 2)->default(0.0)->comment('总收入');
            $table->unsignedInteger('delivery_num')->default(0)->comment('入库(件)');
            $table->unsignedInteger('send_num')->default(0)->comment('派件(件)');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('service');
    }
}
